<template>
    <div id="app">
        <div class="box">
            <h3>小黑自动售货机</h3>
            <button @click="fn(5)">可乐5元</button>
            <button @click="fn(10)">咖啡10元</button>
            <button @click="fn(8)">牛奶8元</button>
            <button @click="fn1(100)">储值100元</button>
        </div>
        <p>银行卡余额：{{money}}元</p>
    </div>
</template>

<script>
    export default {
        name: "7-vue-v-on-参数传递",
        data() {
            return {
                money: 100
            }
        },
        methods: {
            fn(x) {
                this.money = this.money - x
            },
            fn1(n) {
                this.money = this.money + n
            }
        }
    }
</script>

<style scoped>

</style>